# s = 'aa bb cc|dd|ee'
# print(s.split('|',1))  # ['aa', 'bb', 'cc|dd|ee']
#
import pymysql

# docker run -p 8007:3306 --name zc-mysql5.7 \
# --restart=always \
# -v /root/docker/mysql5.7/zc-mysql5.7/conf:/etc/mysql/mysql.conf.d \
# -v /root/docker/mysql5.7/zc-mysql5.7/log:/var/log/ \
# -v /root/docker/mysql5.7/zc-mysql5.7/data:/var/lib/mysql \
# -e MYSQL_ROOT_PASSWORD=123456 \
# -d mysql:5.7
#
#
#
#
# mkdir -p ./conf.d ./log ./html
#
#
# docker run \
# -p 80:80 \
# --name zcsb \
# -v /root/docker/nginx/zcsb/conf.d/:/etc/nginx/conf.d \
# -v /root/docker/nginx/zcsb/log:/var/log/nginx \
# -v /root/docker/nginx/zcsb/html:/usr/share/nginx/html \
# -d nginx:latest


# 当前用户
user_info = {'id': 0, 'name': '未登录'}
# 数据库连接
db_conn = pymysql.connect(
    host='124.221.242.12', port=8006,
    user='root', password='123456',
    db='test1', charset='utf8',
    autocommit=True,
)
username = input('>>>:').strip()
login_sql = f"select * from user_info where name = '{username}';"
print(login_sql)
cursor = db_conn.cursor()
affect_rows = cursor.execute(login_sql)
if affect_rows:
    print('登录成功')
    print(cursor.fetchall())
else:
    print('登录失败')
